package com.ourteam.product.requirement.api;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.ourteam.frame.web.AbstractTreeBuilder;
import com.ourteam.frame.web.TreeViewNodeBean;

public class ProductDefineTreeBuilder extends AbstractTreeBuilder {

	private static Map<String, String> nodeActionMap = new HashMap<String, String>();

	static {
		nodeActionMap.put("productCatalog", "productCatalogNodeActionGroup");
		nodeActionMap.put("productDefine", "productDefineNodeActionGroup");
	}
	

	@Override
	protected TreeViewNodeBean configTreeViewNodeProperties(Object obj, TreeViewNodeBean treeViewNodeBean) {

		String actionGroupId = nodeActionMap.get(treeViewNodeBean.getNodeConfigId());

		if (StringUtils.isNotBlank(actionGroupId)) {
			treeViewNodeBean.setActionGroupId(actionGroupId);
		}
		
		treeViewNodeBean.setShowTag(true);

		return treeViewNodeBean;
	}
	
	@Override
	protected String getTreeConfigFile() {
		return "WEB-INF/conf/ui/product/requirement/product_define_tree.xml";
	}

	@Override
	protected boolean isShowTag() {
		return true;
	}


}
